home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr29 / fih110.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-03-06  |  6KB  |  245 lines

  1. /* Icon Heaven installation script */
  2. /* (C)Copyright 1993-1995 by The Frobozz Magic Software Company */
  3. Call RxFuncadd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4. Call SysLoadFuncs
  5.  
  6. app = 'IHeaven'
  7. key = 'INSTDIR'
  8.  
  9. '@echo off'
  10.  
  11. Call SysCls
  12.  
  13. say 'Icon Heaven installation utility version 1.10'
  14. say '(C)Copyright 1993-1995 by the Frobozz Magic Software Company'
  15.  
  16. /* check to see if Icon Heaven is installed, if so update it */
  17.  
  18. res = SysIni(, app, key)
  19.  
  20. if res <> 'ERROR:' then do
  21.     instdir = res
  22.     call update
  23.     exit
  24. end
  25.  
  26. ini = value('USER_INI',,'OS2ENVIRONMENT')
  27.  
  28. tDrive = left(ini,1)
  29.  
  30. instdir=tDrive':\IHeaven'
  31.  
  32. dll=tDrive':\os2\dll\fim.dll'
  33.  
  34. res=stream(dll,'c','query exists')
  35.  
  36. if res<>'' then do
  37.     call update100
  38.     exit
  39. end
  40.  
  41.  
  42. say 'Please enter the path where Icon Heaven will be installed'
  43. say 'Press [enter] to select the default path ['instdir']'
  44. pull newdir
  45.  
  46. if newdir <> '' then
  47.     instdir = newdir
  48.  
  49. if length(instdir) = 3 then do
  50.      if substr(instdir,3,1) ='\' then
  51.         instdir = left(instdir,2)
  52. end
  53.  
  54. say 'Icon Heaven will be installed in ['instdir']'
  55. 'pause'
  56.  
  57. res = mkdir(instdir)
  58.  
  59. if res <> 0 then do
  60.     say 'The directory ['instdir'] you specified cannot be created'
  61.     say 'installation aborted'
  62.     exit
  63. end
  64.  
  65. /* say 'copying fim.dll to 'instdir */
  66. 'copy fim.ico 'instdir' >nul'
  67. 'copy fim.dll 'instdir' >nul'
  68.  
  69. retval = SysCreateObject('WPFolder', 'Icon Heaven', '<WP_DESKTOP>', 'ICONFILE='instdir'\fim.ico;OBJECTID=<FIM_ICONS>', 'R')
  70.  
  71. if SysRegisterObjectClass('FIMTransIcon', instdir'\fim.dll') then
  72.     say 'FIMTransIcon registered'
  73. else do
  74.     say 'FIMTransIcon registration failed'
  75.     call SysDestroyObject "<FIM_ICONS>"
  76.     'del 'instdir'\fim.dll 'instdir'\fim.ico'
  77.     call SysRmDir instdir
  78.     exit
  79. end
  80.  
  81. if SysRegisterObjectClass('FIMFolder', instdir'\fim.dll') then
  82.     say 'FIMFolder registered'
  83. else do
  84.     say 'FIMFolder registration failed'
  85.     call SysDeregisterObjectClass 'FIMTransIcon'
  86.     call SysDestroyObject "<FIM_ICONS>"
  87.     'del 'instdir'\fim.dll 'instdir'\fim.ico'
  88.     call SysRmDir instdir
  89.     exit
  90. end
  91.  
  92. /* say 'copying fim.hlp to 'instdir */
  93. 'copy fim.hlp 'instdir' >nul'
  94. 'copy iconlib.exe 'instdir' >nul'
  95. 'copy iconlib.ico 'instdir' >nul'
  96. 'copy deinstal.cmd 'instdir' >nul'
  97. 'copy deinstal.ico 'instdir' >nul'
  98. 'copy reinst.cmd 'instdir' >nul'
  99. 'copy replace.exe 'instdir' >nul'
  100. 'copy readme.1st 'instdir' >nul'
  101.  
  102. retval = SysCreateObject('WPProgram', 'Icon Librarian', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;ASSOCFILTER=*.FIM;EXENAME='instdir'\iconlib.exe;ICONFILE='instdir'\iconlib.ico', 'R')
  103. retval = SysCreateObject('WPProgram', 'De-Install', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;EXENAME='instdir'\deinstal.cmd;ICONFILE='instdir'\deinstal.ico', 'R')
  104. retval = SysCreateObject('WPProgram', 'Read Me', '<FIM_ICONS>', 'PROGTYPE=PM;EXENAME=e.exe;PARAMETERS='instdir'\readme.1st', 'R')
  105.  
  106. call instlibs '.'
  107.  
  108. res = SysIni(, app, key, instdir)
  109.  
  110. say 'Installation has been succesfully completed.'
  111. say 'Do you wish me to clean up the installation directory? [N/y]'
  112. pull reply
  113. if left(reply, 1) = 'Y' then do
  114.     call cleanup
  115. end
  116.  
  117. Exit
  118.  
  119.  
  120. instlibs:
  121.  
  122. dir=ARG(1)
  123.  
  124.  
  125. call SysFileTree dir'\*.fim', 'file.', 'FO'
  126.  
  127. say 'Installing icon libraries'
  128.  
  129. Do i=1 to file.0
  130.     targ = instdir'\'filespec('n',file.i)
  131.     'copy' file.i targ '>nul'
  132.     cookie1 = charin(targ)
  133.     cookie2 = charin(targ)
  134.     if cookie1 = 'L' & cookie2 = 'I' then do
  135.         dum = charin(targ,,8)
  136.         n = ''
  137.         c = charin(targ)
  138.         do until c2d(c) = 0
  139.             n = n''c
  140.             c= charin(targ)
  141.         end
  142.         retval = SysCreateObject('FIMFolder', n, '<FIM_ICONS>', 'ICONLIBRARY='targ, 'R')
  143.         say 'Library 'n' added'
  144.         call stream targ,'C','CLOSE'
  145.     end
  146.     else do
  147.         call stream targ,'C','CLOSE'
  148.         'del 'targ
  149.     end
  150. End
  151.  
  152. return
  153.  
  154.  
  155. cleanup:
  156.  
  157. 'del *.fim fim.ico fim.hlp fim.dll iconlib.exe iconlib.ico'
  158. 'del readme.1st install.cmd deinstal.cmd deinstal.ico reinst.cmd'
  159.  
  160. return
  161.  
  162.  
  163. update100:
  164.  
  165. /* update from 1.00 */
  166.  
  167. say ''
  168. say 'Icon Heaven is installed in directory ['instdir']'
  169. say 'Do you wish me to update it ? [Y/n]'
  170. pull reply
  171.  
  172. if left(reply,1)='N' then return
  173.  
  174. /* use default directory */
  175.  
  176. res = SysIni(, app, key, instdir)
  177.  
  178. 'copy fim.dll 'instdir' >nul'
  179. 'copy fim.hlp 'instdir' >nul'
  180. 'copy fim.ico 'instdir' >nul'
  181. 'copy iconlib.exe 'instdir' >nul'
  182. 'copy iconlib.ico 'instdir' >nul'
  183. 'copy readme.1st 'instdir' >nul'
  184. 'copy replace.exe 'instdir' >nul'
  185. 'copy deinstal.cmd 'instdir' >nul'
  186. 'copy deinstal.ico 'instdir' >nul'
  187. 'copy reinst.cmd 'instdir' >nul'
  188.  
  189. retval = SysCreateObject('WPProgram', 'Icon Librarian', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;ASSOCFILTER=*.FIM;EXENAME='instdir'\iconlib.exe;ICONFILE='instdir'\iconlib.ico', 'U')
  190. retval = SysCreateObject('WPProgram', 'De-Install', '<FIM_ICONS>', 'PROGTYPE=WINDOWABLEVIO;EXENAME='instdir'\install.cmd;ICONFILE='instdir'\deinstal.ico', 'U')
  191. retval = SysCreateObject('WPProgram', 'Read Me', '<FIM_ICONS>', 'PROGTYPE=PM;EXENAME=e.exe;PARAMETERS='instdir'\readme.1st', 'U')
  192.  
  193. 'replace 'dll' 'instdir'\fim.dll'
  194. 'del 'dll
  195. 'del 'tDrive':\os2\help\fim.hlp'
  196.  
  197. say 'Icon Heaven has been updated.'
  198. say 'You will need to reboot to make it available'
  199.  
  200. return
  201.  
  202. mkdir: procedure expose (Globals)
  203. parse arg dir
  204. if (length(dir) > 2) then do
  205.     call mkdir(substr(dir,1,lastpos('\',dir)-1))
  206.     res = SysMkDir(dir)
  207. end    
  208. if res = 5 then res = 0
  209. return res
  210.  
  211. update:
  212.  
  213. say ''
  214. say 'Icon Heaven is installed in directory ['instdir']'
  215. say 'Do you wish me to update it ? [Y/n]'
  216. pull reply
  217.  
  218. if left(reply,1)='N' then return
  219.  
  220. dll=instdir'\fim.dll'
  221. tmp=instdir'\t\fim.dll'
  222.  
  223. 'md 'instdir'\t'
  224. 'copy 'dll tmp' >nul'
  225. 'replace 'dll tmp
  226. 'copy fim.dll 'dll' >nul'
  227. 'replace 'tmp dll
  228. 'del 'tmp
  229. 'rd 'instdir'\t'
  230. 'copy fim.hlp 'instdir' >nul'
  231. 'copy fim.ico 'instdir' >nul'
  232. 'copy iconlib.exe 'instdir' >nul'
  233. 'copy iconlib.ico 'instdir' >nul'
  234. 'copy readme.1st 'instdir' >nul'
  235. 'copy replace.exe 'instdir' >nul'
  236. 'copy deinstal.cmd 'instdir' >nul'
  237. 'copy deinstal.ico 'instdir' >nul'
  238. 'copy reinst.cmd 'instdir' >nul'
  239.  
  240.  
  241. say 'Icon Heaven has been updated, '
  242. say 'You will need to reboot to make the new version available'
  243.  
  244. return
  245.